home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
rpgedi1a
/
frmdispl.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1999-10-18
|
22KB
|
494 lines
VERSION 5.00
Begin VB.Form frmDisplay
AutoRedraw = -1 'True
BackColor = &H00000000&
BorderStyle = 3 'Fixed Dialog
ClientHeight = 8595
ClientLeft = 150
ClientTop = 1050
ClientWidth = 10365
ControlBox = 0 'False
Icon = "frmDisplay.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
MouseIcon = "frmDisplay.frx":08CA
MousePointer = 99 'Custom
ScaleHeight = 8595
ScaleWidth = 10365
ShowInTaskbar = 0 'False
WindowState = 2 'Maximized
Begin VB.PictureBox picBack
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00000000&
Height = 23595
Left = -22800
ScaleHeight = 23535
ScaleWidth = 27420
TabIndex = 0
Top = -19320
Visible = 0 'False
Width = 27480
End
Begin VB.PictureBox picBuf
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H00000000&
BorderStyle = 0 'None
Height = 6735
Left = -3840
ScaleHeight = 6735
ScaleWidth = 8850
TabIndex = 2
Top = -2040
Width = 8850
End
Begin VB.PictureBox picSpr
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 6915
Left = 360
Picture = "frmDisplay.frx":0A1C
ScaleHeight = 6855
ScaleWidth = 4035
TabIndex = 1
Top = -600
Visible = 0 'False
Width = 4095
End
Attribute VB_Name = "frmDisplay"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'variables must be declared before use
Option Explicit
'========================================================='
'========================================================='
'=============== RPG Game Version 0.0.4 =================='
'============== Written by Matthew Eagar ================='
'============ Compiled in Visual Basic 6.0 ==============='
'========================================================='
'========================================================='
' This program is a work in progress. As of yet it has no
' actual plot, so it's not really a playable game.
' I'm thinking towards making it almost like a MUD (you know
' those text based RPG's?), except graphical. That's something
' fore the future though...
' This isn't ment to be a full game, just a working engine.
' there is no actual objective. I havn't yet got doors
' working, because that would require me to draw some more
' textures for the insides of houses, which takes FOREVER!
' Also, the textures could REALLY use some work,
' as they were drawn in MS Paint.
' This program may not run well on some computers.
' The method used, bitblt, works well, but isn't designed for games.
' It runs fine on a Pentium 233, but slow on a P75. I havn't tested
' it on anything in between those.
' I'm still working on this, so look for me to post newer versions
' of it. It'll remain free, and it's really ment for educational purposes.
' Check on www.planet-source-code.com for my latest entries. I'll eventually
' be opening my own web page, but for now I'm posting source code there.
' Please contact me with ANY questions, comments, suggestions, or problems,
' ANY input is welcome:
' email: meagar@home.com
' ICQ: 45058462
' Also, I havn't tested this on any computer running anything less then VB6.
' I did run it in vb5, but it took some work.
' You will need the VB6 runtime files the use this.
' ====================================================================
' Updates and Improvements over various versions:
' Updates to Version 0.0.2:
' =========================
' -Added side scrolling and top scrolling
' -Rechanged the map size from 13x11 to 30x30 tiles to accomidate side scrolling
' -Added Bridge Tiles for bridge construction
' -Added sound effects
' -re-wrote most of movement code
' Updates to Version 0.0.3:
' =========================
' -Texture tiles redrawn in greater detail
' -Game speed increased by using While loop instead of timer
' -Options menu added, for adjusting game speed, and walking speed for slower/
' faster systems.
' -Removed the usage of the Plus / Minus keys for game speed, because there
' is now 2 kinds of speed adjustments, game and walking
' Updates to Version 0.0.4:
' =========================
' -Added resolution code for changing the resolution and color depth
' -Added neet startup menu
' -Began implimenting character classes
' -Added many new graphics for character classes
' -Redrew character sprite in much greater detail.
Dim animX As Integer 'holds the current x location of the animation frame
Dim animY As Integer 'holds the current y location of the animation frame
Dim direction As Integer 'the direction the characters facing
Dim charX As Integer 'holds the character's x coords
Dim charY As Integer 'holds the character's y coords
Dim lastX As Integer 'holds the character's last y coords
Dim lastY As Integer 'holds the character's last x coords
Dim BackBuilt As Integer 'determines if the back ground needs to be built
'map variables
Dim mapX As Integer 'holds the current map x number
Dim mapY As Integer 'holds the current map y number
Dim mapArea As String 'the current map mapArea
Dim MapName As String 'holds the name of the map
'the location of the screen
Dim screenX As Integer 'holds the current location of the screen on the map
Dim screenY As Integer 'holds the current location of the screen on the map
Dim charPosX As Integer 'holds the coords to center the character on the screen
Dim charPosY As Integer 'holds the coords to center the character on the screen
Dim sound As Boolean 'holds whether to play sounds or not
Dim moving As Integer 'holds whether the character is moving or not
Dim changeFrame As Integer 'holds when the frame should be changed (animation is much to fast with out this)
Dim sndStep1 As String 'holds the path of the "step sound"
'symbolic constants
'directions
Const dLEFT As Integer = 1 'left direction
Const dUP As Integer = 2 'up direction
Const dRIGHT As Integer = 3 'right direction
Const dDOWN As Integer = 4 'down direction
'animation frames
Const aLEFT As Integer = 133 'left animation
Const aUP As Integer = 67 'up animation
Const aRIGHT As Integer = 199 'right animation
Const aDOWN As Integer = 1 'down animation
'when the user presses a key
Private Sub picBuf_KeyDown(KeyCode As Integer, Shift As Integer)
Dim X As Integer 'counting variable
'if movement, turn the mouse cursor into the invisible icon.
'simply making a mouse cursor that was invisible is easier
'then using API calls.
frmDisplay.MouseIcon = frmTextures.picInvisible.Picture
If moving <> 1 Then
'determine how to act, based on which key the user presses.
Select Case KeyCode
Case Is = 37 'left arrow key
animX = aLEFT 'set the animation frame to the proper direction
direction = dLEFT 'set the direction
Case Is = 38 'up arrow key
animX = aUP 'set the animation frame to the proper direction
direction = dUP
Case Is = 39 'right arrow key
animX = aRIGHT
direction = dRIGHT
Case Is = 40 'down arrow key
animX = aDOWN
direction = dDOWN
Case Is = 27 'escape key
'play the button sound
Call sndPlaySound(sndButton, &H1)
'show the startup window, and hide this one
frmStartup.Show
frmDisplay.Hide
frmStartup.SetFocus
Case Is =